import {request} from './request.js'
export function login(data = {}) {
	return request({
		url: '/oauth/user/token',
		method: 'post',
		data: data,
	})
}

export function userinfo() {
	return request({
		url: '/users/current',
		method: 'get'
	})
}


export function projects(data) {
	return request({
		url: '/yd/getProjectPage?current=1&size=10000',
		method: 'get',
		data
	})
}

export function getYdList(data) {
	return request({
		url: '/yd/app/getYdList',
		method: 'get',
		data
	})
}

export function addOrUpdateYd(data) {
	return request({
		url: '/yd/app/addorUpdate',
		method: 'post',
		data
	})
}
export function getYfList(data) {
	return request({
		url: '/yf/app/getYfList',
		method: 'get',
		data
	})
}

export function addOrUpdateYf(data) {
	return request({
		url: '/yf/app/addorUpdateYf',
		method: 'post',
		data
	})
}

export function delYf(yfId) {
	return request({
		url: `/yf/app/delYf?id=${yfId}`,
		method: 'delete'
		
	})
}
/**
 * 生物量
 * @param {Object} data
 */
export function getBiomass(data) {
	return request({
		url: '/biomass/app/getBiomass',
		method: 'get',
		data
	})
}

export function addOrUpdateBiomass(data) {
	return request({
		url: '/biomass/app/addorUpdate',
		method: 'post',
		data
	})
}

/**
 * 温湿度
 * @param {Object} data
 */

export function getEnvironment(data) {
	return request({
		url: '/environment/app/getEnvironment',
		method: 'get',
		data
	})
}

export function addOrUpdateEnvironment(data) {
	return request({
		url: '/environment/app/addorUpdate',
		method: 'post',
		data
	})
}

/**
 * 草地类型
 * @param {Object} data
 */
export function getGrasslandType(data) {
	return request({
		url: '/grasslandType/app/getgrasslandType',
		method: 'get',
		data
	})
}

export function addOrUpdateGrasslandType(data) {
	return request({
		url: '/grasslandType/app/addorUpdate',
		method: 'post',
		data
	})
}

/**
 * 地下生物量
 * @param {Object} data
 */


export function getSubsurfaceBiomass(data) {
	return request({
		url: '/subsurfaceBiomass/app/getSubsurfaceBiomass',
		method: 'get',
		data
	})
}

export function addOrUpdateSubsurfaceBiomass(data) {
	return request({
		url: '/subsurfaceBiomass/app/addorUpdate',
		method: 'post',
		data
	})
}
export function organizationTree(){
	return request({
		url:'/organization/findOrganizationTree',
		method:'get'
		
	})
}


export function getBrushSurveyList(params){
	return request({
		url:'/brushSurvey/app/getBrushSurveryList',
		method:'get',
		params
	})
}


export function addOrUpdateBrushSurvey(data){
	return request({
		url:'/brushSurvey/app/addOrUpdate',
		method:'post',
		data
	})
}

export function addOrUpdateFrequency(data){
	return request({
		url:'/plantFrequency/app/addOrUpdateFrequency',
		method:'post',
		data
	})
}
export function getFrequencys(data){
	return request({
		url:'/plantFrequency/app/getlist',
		method:'get',
		params:data
	})
}
export function addOrUpdateRichness(data){
	return request({
		url:'/richness/app/addOrUpdateRich',
		method:'post',
		data
	})
}
export function getRichness(data){
	return request({
		url:'/richness/app/getlist',
		method:'get',
		params:data
	})
}

export function addFrequencys(data){
	return request({
		url:'/plantFrequency/app/addFrequencys',
		method:'post',
		data
	})
}